package licode.unisop.client.service.manager;

import licode.unisop.client.api.SopPlatform;
import licode.unisop.client.api.SopPlatformMng;
import licode.unisop.client.api.auth.AuthTokenShim;
import licode.unisop.client.service.manager.SopPlatformLocal;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author licode
 */
@Component
public class AuthTokenShimDef implements AuthTokenShim {
    @Resource
    private SopPlatformLocal sopPlatformLocal;

    @Override
    public String modalToken(String platformId) {
        SopPlatform plat = sopPlatformLocal.getPlatform(platformId);
        return null == plat ? "" : plat.getModalToken();
    }

    @Override
    public String platformToken(String platformId) {
        SopPlatform plat = sopPlatformLocal.getPlatform(platformId);
        return null == plat ? "" : plat.getToken();
    }
}
